There was a superb book published in 1997 (paperback edition) titled The Canon of the New Testament: Its Origin, Development, and Significance, written by the late Bruce Metzger, a biblical scholar and expert in New Testament Greek from Princeton University who was highly renowned in academia and in Christendom. In Part 3 of his book, Metzger covers the issues of canonicity (i.e., the authoritative quality that would make a writing acceptable to be included in the Bible) and inspiration (i.e, the unique quality of a writing that infers its author was moved to write under the influence of the holy spirit). His examination is quite fascinating. Here are some quotes from pages 251-257 . . .
Criteria for Determining Canonicity
A basic prerequisite for canonicity was conformity to what was called the "rule of faith," that is, the congruity of a given document with the basic Christian tradition recognized as normative by the Church. Just as under the Old Testament the message of a prophet was to be tested not merely by the success of the predictions but by the agreement of the substance of the prophecy with the fundamentals of Israel's religion, so also under the New Covenant it is clear that writings which came with any claim to be authoritative were judged by the nature of their content. ...
Another test that was applied to a given book to determine whether it deserved to belong in the New Testament was apostolicity. ... [T]he apostolic origin, real or putative, of a book provided a presumption of authority. ... In the case of Mark and Luke, the tradition of their association with the apostles Peter and Paul respectively was held to validate their writings. ...
Another obvious test of authority for a book was its continuous acceptance and usage by the Church at large. ... [For example, as] the Latin Churches reject Hebrews, so the Greek Churches reject the Apocalypse, but Jerome himself accepts both on the grounds that they are quoted by ancient writers as canonical.
These three criteria (orthodoxy, apostolicity, and consensus among the churches) for ascertaining which books should be regarded as authoritative for the Church came to be generally adopted during the course of the second century and were never modified thereafter. At the same time, however, we find much variation in the manner in which the criteria were applied. There were different opinions as to which criterion should be allowed chief weight. ...
Inspiration and the Canon
[W]hile the Fathers certainly agreed that the Scriptures of the Old and the New Testaments were inspired, they did not seem to have regarded inspiration as the ground of the Bible's uniqueness. That is, the inspiration they ascribe to the Scriptures was only one facet of the inspiring activity of the Holy Spirit in many aspects of the Church's life. ...
[Moreover, the] Fathers do not hesitate to refer to non-Scriptural documents as "inspired," a circumstance showing that they did not consider inspiration to be a unique characteristic of canonical writings. ...
In short, the Scriptures, according to the early Fathers, are indeed inspired, but that is not the reason they are authoritative. They are authoritative, and hence canonical, because they are the extant literary deposit of the direct and indirect apostolic witness on which the later witness of the Church depends.
It's worth noting Metzger's words in the Introduction of the book . . .
The recognition of the canonical status of the several books of the New Testament was the result of a long and gradual process, in the course of which certain writings, regarded as authoritative, were separated from a much larger body of Christian literature. Although this was one of the most important developments in the thought and practice of the early Church, history is virtually silent as to how, when, and by whom it was brought about. Nothing is more amazing in the annals of the Christian Church than the absence of detailed accounts of so significant a process. ...
With that historical context in mind, the originating question of this thread was: "How do JW's know that the bible is inspired?"
The short answer, cliche as it is, is that we accept by faith that the Bible is inspired (where we understand "inspired" to mean that the writings were penned by authors under the influence of the holy spirit. As to the implications of that influence where it concerns the nature of inspiration, that's a far deeper discussion for another time).
We can accept that the Hebrew Scriptures are inspired by the holy spirit since we know first century Jews, including Jesus, accepted the Hebrew Scriptures as inspired and from God (though with qualification: many Jews, Jesus among them, accepted the Torah and the Prophets as inspired and authoritative, whereas many other Jews accepted only the Torah as inspired). We also know that first century Christian writers of the Greek Scriptures, such as Peter and Paul, considered the Hebrew Scriptures to be inspired (see 2 Peter 2:1 and 2 Timothy 3:16). As such, the Hebrew Scriptures were considered authoritative because they were considered inspired. Thereby we can conclude that acceptance of the inspiration of the Hebrew Scriptures constituted an integral component of "the teaching of the apostles" (see Acts 2:42), and therefore we as Christians who are inheritors of the teaching of the apostles accept the Hebrew Scriptures as inspired and authoritative.
As for the Christian Greek Scriptures, inasmuch as they are records of the apostles' teachings witnessing to Jesus Christ and the Good News of the Kingdom in fulfillment of Hebrew Scripture prophecies (particularly the books of Matthew, Mark, Luke, John, and Acts), we can accept them as inspired and thereby authoritative. (compare Matthew 1:1; Matthew 28:20; Luke 1:3, 4; John 20:31)
The most honest answer, though, is that our "knowing" is a function of our "accepting" which is a function of our faith. (So long as our "knowing" by faith doesn't morph into an idolization of the Bible.)